1. Field of the Invention
The present invention relates to a storage device, for example, a magnetic disk unit and an optical disk unit, wherein upon receipt of a read command issued by the exterior, for example, a host system, data is read out from a storage medium, for example, a magnetic disk and an optical disk, and is stored in a read buffer in the form of a cache data, and the cache data, which is stored in the read buffer, is transferred to the exterior (for example, a host system).
2. Description of the Related Art
Hitherto, in a magnetic disk unit for accessing a magnetic disk or an optical disk unit for accessing an optical disk, when such a disk unit receives a read command from a host system, the disk unit not only reads out data of data amount designated by the read command from a read first address designated by the read command, of a storage medium such as the magnetic disk and the optical disk, but also performs a so-called read-ahead in which an idle-time, until the next command is received, is utilized to continue the reading in order of the address. The data read out from the storage medium is stored in the read buffer in the form of cache data, and data requested by the read command, of the cache data stored in the read buffer, but the read-ahead data, is transferred to the host system which is a source of generation of the read command. When such a read-ahead is performed and then the subsequent read command is received, it is determined whether the data, which is requested by the received read command, is already stored in the read buffer. When it is determined that the data is already stored in the read buffer, the cache data stored in the read buffer is read out without accessing the storage medium and is transmitted to the host system. This contributes to shortening the access time.
Hitherto, as a storage scheme of data read out from a storage medium into a read buffer, there are known two schemes as set forth below.
(1) A scheme in which a one read buffer is fixedly partitioned into a plurality of segments each for storing the associated read command.
(2) A scheme in which a one read buffer is not fixedly partitioned into a plurality of segments, but datum (data requested from the host system and read-ahead data) for each read command are sequentially stored in read buffer.
According to the above-mentioned scheme (1), it is possible to simultaneously store on the read buffer a plurality of cache datum in which addresses on the storage medium are discontinuous. But according to the scheme (1), a cache size for each segment is restricted, since the read buffer is partitioned into a plurality of segments. Thus, in the event that a sequential read command (a read command wherein with respect to the final address of a read area on a storage medium, which is designated the past read command, the subsequent address is established as a read first address) is continuously issued, the device will be restricted in performance.
Further, according to the above-mentioned scheme (2), there is a high possibility that cache data stored in the read buffer by the read-ahead, which may be utilized later, is overwritten by data read out from the storage medium in accordance with a read command newly issued and the subsequent read-ahead data. Particularly, in the even that the sequential read command is sequentially issued, there is a high possibility of an overwrite. This is associated with a problem that the cache data, which is read out from the storage medium and is stored in the read buffer, cannot be efficiently utilized.
Further, as a modification of the above-mentioned scheme (1), there is known a scheme that a vacant area of a read buffer is managed in units of address so that only a read-ahead data is accumulated on the read buffer. According to this scheme, however, an address management for controlling this is complicated. Further, when a new read command is issued, it is complicated as to a determination whether data requested by the new read command is stored in the read buffer. Furthermore, according to the modification as mentioned above, there is a need to prepare an especial circuit for accessing data requested by the read command, in the event that the data is stored in the read buffer.
In view of the foregoing, it is an object of the present invention to provide a storage device capable of effectively holding on a buffer data which is not yet transferred, and thereby shortening an access time.
To achieve the above-mentioned objects, the present invention provides a storage device wherein data is read out from a storage medium in accordance with a read command entered from an exterior to be stored in a buffer, and the data stored in the buffer is transferred to the exterior, said storage device comprising:
read control means for performing such a read-ahead that when data requested by the present read command is not stored in said buffer, the data designated by the present read command is read out from said storage medium so as to be stored in areas of an address et seq. subsequent to a final address of an area in which data is already stored, and the data designated by the present read command is transferred to the exterior, and datum are read out continuously in turn from said storage medium to be stored in said buffer; and
weighting means for applying weighting to a data area storing datum on which addresses on said storage medium are continued on said storage medium, on said buffer, in accordance with an amount of residual datum not transmitted to the exterior, in the data area.
In the storage device according to the present invention as mentioned above, it is acceptable that said weighting means performs weighting for each data area in accordance with at least one of an access frequency to the data area, an elapsed time since the data area is subjected to the last access, and a number of times of an issuance of an external read command since the data area is subjected to the last access, as well as the amount of residual datum not transmitted to the exterior.
In the storage device according to the present invention as mentioned above, it is preferable that said read control means provides such a control that when data requested by the present read command is not stored in said buffer, the data designated by the present read command is read out from said storage medium so as to be stored in a data area of the minimum weight applied to said weighting means, of said buffer.
In the storage device according to the present invention, datum read from the storage medium are sequentially stored in the buffer closely. This feature makes it possible to effectively use the buffer in its entirety. Further according to the storage device of the present invention, a weighting is applied for each data area separated in a discontinuous point in address on the storage medium, on the buffer, and an overwrite is performed on an data area of the minimum weight. This feature makes it possible to remain on the buffer much datum which are concerned with high possibility in the later use, and thereby contributing to the effective utilization of the cache data and also improving the access speed.
In the storage device according to the present invention as mentioned above, it is preferable that said read control means inhibits an overwrite on an data area of the maximum weight applied to said weighting means, of said buffer, and performs an overwrite on areas but the data area of the maximum weight, of said buffer, so that data read out from said storage medium is stored in said buffer.
When no vacant area exist in the buffer, a overwrite is performed on the data area of the minimum weight applied by the weighting means. However, even in a case where a need of the overwrite arises exceeding a size of the data area, a provision of the overwrite as to the data area of the maximum weight applied by the weighting means may contributing to a harmonization between the effective utilization of the cache data on the buffer and a requirement that a wide storage area on the buffer is ensured to store in the buffer data newly read out from the storage medium.
In the storage device according to the present invention as mentioned above, it is preferable that said weighting means performs weighting in such a manner that when a data area of the maximum weight of said buffer is accessed by said read control means, the maximum weight is applied to any data area of data areas but the accessed data area.
In some case, it happens that data requested by the read command newly issued exists in the data area of the maximum weight in the buffer. In this case, the data area of the maximum weight is accessed. In this case, an establishment of any one of the data areas but the data area of the maximum weight accessed to the maximum weight may contributing to a harmonization between the effective utilization of the cache data on the buffer and a requirement that a wide storage area on the buffer is ensured to store in the buffer data newly read out from the storage medium. When the data area having the maximum weight is accessed, at least part of the datum stored in the associated data area is read out therefrom and transferred. An amount of non-transferred datum of the data area is decreased, and as a result the weight of the data area is lowered.
In the storage device according to the present invention as mentioned above, it is preferable that in the event that all datum requested by the present read command are stored in any one of the data areas of said buffer, and a first address of an area storing data requested by the present read command, of the data area is a subsequent address to a final address of an area storing data transferred to the exterior according to the past read command served for formation of the data area, of the data area, said read control means starts in accordance with the present read command a read-ahead from a subsequent address to an address in which data stored in a final address of the data area was stored, on said storage medium.
In the event that all datum requested by the present read command are stored in any one of areas of the buffer (this is referred to a xe2x80x9cfull hitxe2x80x9d), and the present read command is a sequential command to the past read command served for formation of the data area, there is a high possibility that a sequential command to the present read command is further issued, since the present read command is a sequential command. Therefore, in the event that this condition is satisfied, the read-ahead is carried out. To carry out the read-ahead at the time of full hit, a provision of such a condition that the present read command is a sequential command to the past read command may prevent an increment of an overhead by an execution of useless read-ahead, and also prevent useless overwrite onto additional data areas.
In the event that only part of datum requested by the present read command exists in the buffer (this is referred to a xe2x80x9cpartial hitxe2x80x9d), the insufficient datum are read out from the storage medium regardless of the fact that the present read command is a sequential command, and when an idle time exists until an issuance of the next read command, the read-ahead is carried out.
Incidentally, the storage device of the present invention can be understood as follows.
To achieve the above-mentioned objects, the present invention provides a storage device wherein data is read out from a storage medium in accordance with a read command entered from an exterior to be stored in a buffer, and the data stored in the buffer is transferred to the exterior, said storage device comprising:
determination means for determining whether data requested by the present read command is already stored in the buffer;
read control means for performing such a read-ahead that when data requested by the present read command is already stored in said buffer, the data designated by the present read command is read out from said buffer so as to be transferred to the exterior, and when data requested by the present read command is not stored in said buffer, and a vacant area storing no data exists in said buffer, datum on areas storing datum of an amount of datum designated by the present read command, of the read first address et seq. designated by the present read command, of the storage medium, is read out from said storage medium so as to be stored in areas of an address et seq. subsequent to a final address of an area in which data is already stored, and the data designated by the present read command is transferred to the exterior, and datum are read out continuously in turn from said storage medium so as to be stored in said buffer even after the termination of read out of data designated by the present read command from the storage medium; and
weighting means for applying weighting according to a degree of an importance as to a save of data on the buffer to a data area storing datum on which addresses on said storage medium are continued on said storage medium, on said buffer, in accordance with an amount of residual datum not transmitted to the exterior, in the data area,
wherein said read control means provides such a control that when data requested by the present read command is not stored in said buffer, and when no vacant area exists in said buffer, the datum of the amount of datum designated by the present read command is read out from areas of the read first address et seq. designated by the present read command, of the storage medium, so as to be stored in data areas of the first address et seq. of the data area of the minimum weight applied to said weighting means, of said buffer, and the data requested by the present read command, which is stored in the buffer, is transferred to the exterior, and in addition the read-ahead is carried out.